const { getList: MGT,remove: MR} = require('../model/getComment')

const getList = async (req, res, next) => {
  const { goodsId } = req.query

  const result = await MGT(goodsId - 0)
  res.send({
    message: '获取留言列表成功',
    code: 1,
    yourParams: {
      msg: '这是你带来的参数, 我带回去给你看看 ^_^',
      goodsId
    },
    comment: result
  })
}




const remove = async (req, res, next) => {
  const{commentId}=req.body

  const result = await MR(commentId - 0)


  if (result === 0) return res.send({
    message: '删除留言失败',
    code: 0,
    tips: `你传递给我的 'commentId' 是 : '${ commentId }' ^_^`
  })

  res.send({
    message: '删除留言成功',
    code: 1
  })
}



module.exports = {
  getList,
  remove
}
